import { Component } from "react";

export default class ClassComp extends Component{
  constructor(props){
    super()

    console.log('constructor',props)
  }

  sendValueToParent=()=>{
    this.props.callback(100)
  }

  render(){
    console.log('--render--',this.props)
    return(
      <div>
        ClassChild
        <p>
          {this.props.admin} {this.props.age} {this.props.foods.price}
        </p>
        <p>
          <button onClick={this.sendValueToParent}>子组件传值给父组件</button>
        </p>

        <p>{this.props.price}</p>
      </div>
    )
  }

}